home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CUCD / Programming / AMOSList / AMOSLIST / text0075.txt < prev    next >
Encoding:
Text File  |  1998-04-01  |  9.4 KB  |  265 lines

  1. Since working with the GUI Extension, and also on my Mailinglist software,
  2. ive been asked by several AMOS users how it is possible for the betatesters
  3. to send their information directly to me via the net (without saving it to
  4. YAM/UUSPOOL first). Included in this mail, is the source code for placing
  5. such a form in your own creations. Attached to this mail is a file named
  6. Mailform.WIN which you should simply load as a window in your GadToolsBox
  7. file, and save accordingly. You will also need to change the Gui Open/Close
  8. commands to react correctly with it. This program should work with Gui V1.62
  9. although I haven't tried.
  10.  
  11. Feel free to use this program in your own productions, just give me and the
  12. PD library a mention in the documentation/in the program. If you have any
  13. comments/questions about this routine, feel free to email me or the list.
  14.  
  15. ' Simple Mailform program. Written using the GUI Extension (V1.70) 
  16. ' Written by Andy "Mushroom" Kellett C Mushroom PD 1998. 
  17. '
  18. ' This program is freely usable by anybody.
  19. '  
  20. ' Note, that you WILL have to change the GUI Open/Close commands to respond
  21. ' to that of the correct one in your program. You will also need to  
  22. ' customize the program + SMTP servers to your own needs.
  23. '
  24.  
  25. Dim LV$(200)
  26. Global LV$()
  27.  
  28. Procedure EMAILREQUEST
  29.    ' This part of the program asks for the user's information so that they
  30. can
  31.    ' be contacted in the future about any new releases/updates or other info
  32.    ' which can be sent to them. It also gives me an idea of just who is
  33. using 
  34.    ' the program, so you can determine which part of the world wishes to use
  35. it 
  36.    ' more.
  37.    
  38.    Proc COUNTRYS : Rem Read in the list of countrys to the large array
  39.    
  40.    Gui Open 2,10,20 : Rem Open up the GUI Screen 
  41.    Gui Set 2,4,1,Array(LV$(0)) : Gui Set 2,4,0,0 : Rem Setup array and First
  42. selection
  43.    
  44.    LP1:
  45.    A=Gui Wait
  46.    
  47.    If A=0 : Rem SEND INFO button hit 
  48.       Goto _PROCESS
  49.    End If 
  50.    
  51.    Goto LP1
  52.    
  53.    _PROCESS:
  54.    ' Check the status of the gadgets to make sure no abnormalities will be
  55. sent 
  56.    ' to my email box. 
  57.    
  58.    NAME$=Gui Read$(2,1) : EM$=Gui Read$(2,2) : WWW$=Gui Read$(2,3) : CC$=Gui
  59. Read$(2,4)
  60.    
  61.    ' First check for blank headers
  62.    If NAME$="" or EM$="" : Rem Blank Entry's
  63.       A=Gui Req("Mail Error...","Blank Fields Remain in Entry","OK") : Goto
  64. LP1
  65.    End If 
  66.    
  67.    ' Now check that email contains the correct information
  68.    I=Instr(EM$,"@")
  69.    If I=0
  70.       A=Gui Req("Mail Error...","Email address is incorrect. Please
  71. check.","OK") : Goto LP1
  72.    End If 
  73.    
  74.    ' I guess its safe to say that the email is pretty good to go once it
  75. gets here  
  76.    ' As well as the information given in the form, the program will send me 
  77.    ' the following pieces of information regarding the user:
  78.    '
  79.    '       There hostname ($HOSTNAME) 
  80.    '       There real name ($REALNAME)
  81.    '
  82.    ' This just gives me a brief idea of what will be going on with the
  83. program
  84.    
  85.    LP2:
  86.    SERV$="mail.redrose.net" : Rem Change to your Mailserver
  87.    HOST$="redrose.net" : Rem Change to your Host
  88.    _TO$="mushypd@redrose.net" : Rem Change to your Email address 
  89.    FROM$=EM$
  90.    EC$=Chr$(13)+Chr$(10)
  91.    
  92.    If Not Exist("Ram:Env/HOSTNAME")
  93.       LP3:
  94.       TEX$="It would appear that your Amiga is not"+Chr$(10)
  95.       TEX$=TEX$+"connected to the internet. Please connect"+Chr$(10)
  96.       TEX$=TEX$+"your machine to the internet, and hit the"+Chr$(10)
  97.       TEX$=TEX$+"RETRY button to continue. If it is connected"+Chr$(10)
  98.       TEX$=TEX$+"then please ensure the connection is OK."
  99.       
  100.       A=Gui Req("Connection Error...",TEX$,"Retry") : Goto LP2
  101.    End If 
  102.    
  103.    Trap A=Tcp Open(1,SERV$+"/25") : E=Errtrap : Tcp Limit 500
  104.    
  105.    ' IMPORTANT NOTE 
  106.    '
  107.    ' Some SMTP mailservers do not use Port 21 (SMTP) but port 25. If your 
  108.    ' program doesnt work on the one port, then try the other (21). One way
  109.    ' to test, is to connect to it with a Telnet program, as you should get
  110.    ' a "ESMTP Server Ready" message if you connect correctly. 
  111.    
  112.    If A=False or E>0
  113.       A=Gui Req("Error.","Couldnt resolve SMTP Host","OK") : Goto LP3
  114.    End If 
  115.    
  116.    Open Out 2,"Sys:MailResults"
  117.    
  118.    A=Tcp Put$(1,"HELO "+HOST$+EC$)
  119.    A=Tcp Put$(1,"MAIL FROM: <"+FROM$+">"+EC$)
  120.    A=Tcp Put$(1,"RCPT TO: <"+_TO$+">"+EC$)
  121.    A=Tcp Put$(1,"DATA"+EC$)
  122.    A=Tcp Put$(1,"To: <"+_TO$+">"+EC$) : 
  123.    A=Tcp Put$(1,"From: My Program <"+FROM$+">"+EC$)
  124.    A=Tcp Put$(1,"Subject: Internal Program Email"+EC$)
  125.    A=Tcp Put$(1,"X-Comment: AMOSPro Test"+EC$)
  126.    A=Tcp Put$(1,"X-Mailer: AMOSPro"+EC$+EC$)
  127.    
  128.    ' Now, another list of stuff to send. Ive put into data statements to
  129.    ' limit the amount of repetitive code used.
  130.    
  131.    TEX$="hostname" : V=1 : Gosub _GETFILE
  132.    Inc V : TEX$="realname" : Gosub _GETFILE
  133.    
  134.    D1:
  135.    Data "Name: "+NAME$,"Email Address: "+EM$,"WWW: "+WWW$,"Country: "+CC$,"
  136. "
  137.    Data "This Mailform was sent from My Program. The version of the"
  138.    Data "program reported itself as being:"," ",VER$," "
  139.    Data "This particular version of the program is unregistered, and was
  140. released"
  141.    Data "into the public on March 5, 1998."," "
  142.    Data "Hostname: "+HN$,"Real Name: "+RN$
  143.    Data "*"
  144.    
  145.    Restore D1
  146.    Repeat 
  147.       Read G$ : Rem Read in mail input 
  148.       If G$<>"*"
  149.          A=Tcp Put$(1,G$+EC$) : Print #2,G$+Chr$(10);
  150.       End If 
  151.    Until G$="*"
  152.    
  153.    A=Tcp Put$(1,"."+EC$)
  154.    A=Tcp Put$(1,"QUIT"+EC$)
  155.    
  156.    Gui Pause 50
  157.    Tcp Close 1 : Close 2
  158.    
  159.    TEX$="Your information has been emailed directly"+Chr$(10)
  160.    TEX$=TEX$+"to the author, and you will be placed on the"+Chr$(10)
  161.    TEX$=TEX$+"list of betatesters, and will also receive info"+Chr$(10)
  162.    TEX$=TEX$+"on new updates etc. A copy of the information"+Chr$(10)
  163.    TEX$=TEX$+"sent can be found in SYS:MailResults"+Chr$(10)+Chr$(10)
  164.    TEX$=TEX$+"Thank-you"
  165.    
  166.    A=Gui Req("Mail Notification",TEX$,"No Problem!")
  167.    A=Gui Close(2) : Gui On 1
  168.    Pop Proc
  169.    
  170.    End 
  171.    
  172.    _GETFILE:
  173.    P$=""
  174.    If Exist("RAM:ENV/"+TEX$) : Rem Enviroment File
  175.       Open In 1,"Ram:Env/"+TEX$ : P$=Input$(1,Lof(1)) : Close 1
  176.    End If 
  177.    
  178.    If V=1 : HN$=P$ : End If 
  179.    If V=2 : RN$=P$ : End If 
  180.    Return 
  181.    
  182.    _ERROR:
  183.    TEX$="An error has occured. Please check the"+Chr$(10)+"connection you
  184. have to the internet"
  185.    TEX$=TEX$+Chr$(10)+"and hit the RETRY button. If you want
  186. to"+Chr$(10)+"abort this operation for the moment"
  187.    TEX$=TEX$+Chr$(10)+"then hit the CANCEL button."
  188.    
  189.    A=Gui Req("Processing Error...",TEX$,"Retry|Cancel")
  190.    
  191.    ' 1 = Retry
  192.    ' 0 = Cancel 
  193.    
  194.    If A=1 : Goto LP2 : End If 
  195.    If A=0 : Trap Kill "MLM:Data/MailResults" : A=Gui Close(2) : Gui On 1 :
  196. Pop Proc : End If 
  197. End Proc
  198.  
  199. Procedure COUNTRYS
  200.    CT:
  201.    Data "Afghanistan","Albania","Algeria","Andorra","Angola","Antigua and
  202. Barbuda","Argentina","Armenia","Australia","Austria","Azerbaijan"
  203.    Data "Bahamas,
  204. The","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bhutan","Bolivia","Bosnia
  205. and Herzegovina"
  206.    Data "Botswana","Brazil","Brunei","Bulgaria","Burkina
  207. Faso","Burma","Burundi","Cambodia","Cameroon","Canada","Cape Verde"
  208.    Data "Central African
  209. Republic","Chad","Chile","China","Colombia","Comoros","Congo
  210. (Brazzaville)","Congo (Kinshasa)","Costa Rica","Cote d'Ivoire","Croatia"
  211.    Data "Cuba","Cyprus","Czech Republic","Denmark","Djibouti
  212. ","Dominica","Dominican Republic","Ecuador","Egypt","El
  213. Salvador","Equatorial Guinea"
  214.    Data
  215. "Eritrea","Estonia","Ethiopia","Fiji","Finland","France","Gabon","Gambia,
  216. The","Georgia","Germany","Ghana"
  217.    Data
  218. "Greece","Grenada","Guatemala","Guinea","Guinea-Bissau","Guyana","Haiti","Honduras","Hungary","Iceland","India"
  219.    Data
  220. "Indonesia","Iran","Iraq","Ireland","Israel","Italy","Jamaica","Japan","Jordan","Kazakhstan","Kenya"
  221.    Data "Kiribati","Korea, North","Korea,
  222. South","Kuwait","Kyrgyzstan","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya"
  223.    Data "Liechtenstein","Lithuania","Luxembourg","Macedonia, The Former
  224. Yugoslav Republic
  225. of","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall
  226. Islands"
  227.    Data "Mauritania","Mauritius","Mexico","Micronesia, Federated States
  228. of","Moldova","Monaco","Mongolia","Morocco","Mozambique","Namibia","Nauru"
  229.    Data "Nepal","Netherlands","New
  230. Zealand","Nicaragua","Niger","Nigeria","Norway","Oman","Pakistan","Palau","Panama"
  231.    Data "Papua New
  232. Guinea","Paraguay","Peru","Philippines","Poland","Portugal","Qatar","Romania","Russia","Rwanda","Saint
  233. Kitts and Nevis"
  234.    Data "Saint Lucia","Saint Vincent and the Grenadines","Samoa","San
  235. Marino","Sao Tome and Principe","Saudi Arabia","Senegal","Serbia and
  236. Montenegro","Seychelles","Sierra Leone","Singapore"
  237.    Data "Slovakia","Slovenia","Solomon Islands","Somalia","South
  238. Africa","Spain","Sri Lanka","Sudan","Suriname","Swaziland","Sweden"
  239.    Data
  240. "Switzerland","Syria","Taiwan","Tajikistan","Tanzania","Thailand","Togo","Tonga","Trinidad
  241. and Tobago","Tunisia","Turkey"
  242.    Data "Turkmenistan","Tuvalu","Uganda","Ukraine","United Arab
  243. Emirates","United Kingdom","United States","Uruguay","Uzbekistan","Vatican
  244. City","Vanuatu"
  245.    Data "Venezuela","Vietnam","Yemen","Zambia","Zimbabwe",""
  246.    
  247.    Restore CT
  248.    L=0
  249.    Repeat 
  250.       Read LV$(L) : Inc L
  251.    Until LV$(L-1)=""
  252. End Proc
  253.  
  254. -- 
  255.  Email: Andy Kellett <mushypd@redrose.net>  Team *AMOS* + IAPA Team *AMIGA*
  256.   *alt.religion.amos* - AMOS now on usenet! AMOS Mailinglist also mirrored
  257.  
  258. * Proud Member of the AMOSPro V3 Development Team & Official AMOS Library *
  259.  
  260.      World's Largest AMOS Homepages - http://www.mushy-pd.demon.co.uk
  261.  
  262.    Also official US distributor of  F1 Software. Quality Amiga titles at
  263.                 quality prices. See homepage for links.
  264.  
  265.